package LinkedListDeque;


import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

class LinkedListDequeTest {
     LinkedListDeque<Integer>  deque = new LinkedListDeque<Integer>(5);
    @Test
    void offer() {
        deque.offerLast(2);
        deque.offerLast(3);
        deque.offerLast(4);
        deque.offerLast(5);
        deque.offerFirst(1);
        assertIterableEquals(List.of(1,2,3,4,5), deque);
    }

    @Test
    void poll() {
        deque.offerLast(2);
        deque.offerLast(3);
        deque.offerLast(4);
        deque.offerLast(5);
        deque.offerFirst(1);
        assertEquals(1,deque.pollFirst());
        assertEquals(2,deque.pollFirst());
        assertEquals(5,deque.pollLast());
        assertEquals(4,deque.pollLast());
        assertEquals(3,deque.pollLast());
        assertNull(deque.pollLast());
        assertTrue(deque.isEmpty());
    }
}